//不同于lodash的get，有复杂的类型判断，这里只用作简单的object的多级别访问
export const simpleGet=(...args)=>{
    let[obj,path,defVal]=args;
    if(!path){
        return obj[path];
    }
    if(typeof path==='string'){
        path=path.split('.')
    }
    let rst=obj;
    for(let i=0;i<path.length;i++){
        rst=rst[path[i]];
        if(rst===null||rst===undefined){
            return args.length>2?defVal:rst;
        }
    }
    return rst;
};
export default simpleGet;